package com.haruhinav.controller;

import com.haruhinav.Utils.TimeTool;
import com.haruhinav.entity.Hitoko;
import com.haruhinav.entity.vo.ResultVO;
import com.haruhinav.service.HitokoService;
import org.apache.ibatis.annotations.ResultMap;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Date;
import java.util.Calendar;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/api/hitoko")
public class HitokoController {
    @Resource
    private HitokoService hitokoService;


    @PostMapping("/a/insert")
    public ResultVO insertHitokoto(@RequestBody Hitoko hitoko){
        ResultVO result = hitokoService.insertHitoko(hitoko);

        return result;
    }
    @GetMapping("/a/query")
    public Map<String,Object> findHitokoByUId(@RequestParam("uid") Integer uid){


        return hitokoService.findHitokoByUId(uid);
    }
    @PostMapping("/a/update")
    public ResultVO updateHitokoById(@RequestBody Hitoko hitoko){
        return hitokoService.updateHitokoById(hitoko);
    }

    @PostMapping("/a/checkdate")
    public ResultVO checkDateEqualNow(@RequestBody Hitoko hitoko){
        return hitokoService.checkDateEqualNow(hitoko.getId());

    }
}
